package iblink.junit;

import java.util.Date;
import java.util.List;

import iblink.adapter.IBFacade;
import iblink.core.HistoricalData;
import iblink.core.ScannerArgs;
import iblink.core.Stock;
import iblink.core.ScannerArgs.Instrument;
import iblink.core.ScannerArgs.LocationCode;
import iblink.core.ScannerArgs.ScanCode;
import iblink.core.ScannerData;
import iblink.util.Constants.BarSize;
import iblink.util.Constants.DataType;
import iblink.util.Constants.Duration;

public class Sandbox {

	private static IBFacade ibFacade = TestHelper.getIBFacade();

	public static void main(String args[]) {

		Stock s = new Stock("CCIH", null, null, null, null, "NASDAQ");

		// get 1-minute bars for the last trading day
		List<HistoricalData> histData = ibFacade.getHistoricalData(s,
				new Date(), Duration.ONE_DAY, BarSize.ONE_MIN, DataType.TRADES,
				true);

		for (HistoricalData hd : histData) {
			System.out.println(hd);
		}

	}

	public static void scannerExample() {

		ScannerArgs sa = new ScannerArgs(LocationCode.STK_US_MAJOR,
				Instrument.STK, ScanCode.HIGH_OPT_VOLUME_PUT_CALL_RATIO);

		sa.numberOfRows(1000);
		List<ScannerData> sd = ibFacade.getScannerData(sa);

		for (ScannerData s : sd) {
			System.out.println(s);
		}

		System.out.println(sd.size());
	}
}